import React, {PropTypes, Component} from 'react';
import lyby from '../components/util';
export default class AppEnterLogin extends Component {
    constructor(props) {
        super(props);
        let userinfo = lyby.loginUser.getData();
        if (!userinfo || !userinfo.userId) {
            window.location.href = '/user/login?redirect=http%3A%2F%2Fzenchina.org%2Fcommunity%2Findex.html';
        }
        return false;
    }

    render() {
        let userinfo = lyby.loginUser.getData();
        if (!userinfo || !userinfo.userId) {
            return null;
        }
        return (
            <div>
                {this.props.children}
            </div>
        );
    }
}

AppEnterLogin.propTypes = {
    children: PropTypes.element
};
